import React,{Component} from 'react';
export default class Counter extends React.PureComponent{
	constructor(props) {
		super(props);
		this.state={count:1};
	}
	shouldComponentUpdate(nextProps,nextState) {
		if (this.props.color != nextProps.color) {
			return true;
		}
		if (this.state.count != nextState.count) {
			return true;
		}
		return false;
	}
	render() {
		return (
			<button
				color={this.props.color}
				onClick={() => this.setState(state => ({count:this.state.count + 1}))}
			>
				Count:{this.state.count}
			</button>
		)
	}
}